package com.example.volunteer.model;


import lombok.Data;

import java.util.Date;

@Data
public class Activity {
    private Integer activityId;
    private String title;
    private Date startTime;
    private Date endTime;
    private String address;
    private Integer participantLimit;
    private String status;
    private String adminId;
    private Date createdTime;

    public Double getVolunteerHours() {
        if (startTime == null || endTime == null) {
            return 0.0;
        }
        long diffInMillis = endTime.getTime() - startTime.getTime();
        // 将毫秒转换为小时
        return (double) Math.round((diffInMillis / (1000.0 * 60 * 60)));
    }
    public void setVolunteerHours(Double volunteerHours) {
        // 这里不实现，因为志愿者小时数是根据活动开始和结束时间自动计算的
    }
    public Integer getActivityId() {
        return activityId;
    }

    public void setActivityId(Integer activityId) {
        this.activityId = activityId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Integer getParticipantLimit() {
        return participantLimit;
    }

    public void setParticipantLimit(Integer participantLimit) {
        this.participantLimit = participantLimit;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getAdminId() {
        return adminId;
    }

    public void setAdminId(String adminId) {
        this.adminId = adminId;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }
}